package inspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.util.StopWatch;

/**
 * Created by Shirly on 2016/8/18.
 */
@Aspect
public class MethodExecutionTime {
    @Pointcut("execution(* *..StockService.getBaseInfo(..))" +
            " || execution(* *..FundService.getBaseInfo(..))" +
            ")")
    public void methodsToBeProfiled(){}

    @Around("methodsToBeProfiled()")
    public void profile(ProceedingJoinPoint pjp) throws Throwable {
//        StopWatch sw = new StopWatch(getClass().getSimpleName());
//        try {
//            sw.start(pjp.getSignature().toShortString());
//            return pjp.proceed();
//        } finally {
//            sw.stop();
//            System.out.println(sw.prettyPrint());
//        }
        System.out.println("此方法被拦截了哈。。。。。。。。。。。。");
    }
}
